package com.hx.setting.entity;

import com.hx.setting.entity.Entity;
import java.io.Serializable;
import java.util.Date;
import org.json.JSONObject;

/**
 * Generate Date : 2014-03-16
 * Generate Version : v3.0
 * Generate Name : Honey v3.1 Test
 * Generate User : THINK
 * JDK Version : 1.5
 */
public class GroupsEntity extends AbstractEntity implements Serializable, Entity
{

	/** 类序列化版本标识 */
	private static final long	serialVersionUID	= 3599676170549090331L;

	/** id */
	private Long				id;

	/** 组名称 */
	private String				groupName;

	/** 
	 * 默认构造函数
	 */
	public GroupsEntity()
	{
		super();
	}

	/** 
	 * 带参数构造函数
	 */
	public GroupsEntity(Long id/*id */, String groupName/*组名称 */)
	{
		this.setId( id );//id 
		this.setGroupName( groupName );//组名称
	}

	/** 
	 * 获取id
	 * @return id
	 */
	@Override
	public final Long getId()
	{
		return this.id;
	}

	/** 
	 * 设定id
	 * @param id
	 * @return 返回自身
	 */
	public final GroupsEntity setId(Long id)
	{
		this.id = id;
		return this;
	}

	/** 
	 * 获取组名称
	 * @return 组名称
	 */
	public final String getGroupName()
	{
		return this.groupName;
	}

	/** 
	 * 设定组名称
	 * @param groupName
	 * @return 返回自身
	 */
	public final GroupsEntity setGroupName(String groupName)
	{
		this.groupName = groupName;
		if ( this.groupName != null && this.groupName.length() == 0 ) this.groupName = null;
		return this;
	}

	@Override
	public int hashCode()
	{
		int answer = -1;
		String solt = "gUgzW";//随机盐
		answer = new StringBuilder().append( "GroupsEntity" ).append( this.id ).append( this.groupName ).append( solt ).toString().hashCode();
		return answer;
	}

	@Override
	public String toString()
	{
		return new StringBuilder()
				.append( "GroupsEntity : [" )
				.append( "    id : " )
				.append( this.id )
				.append( "    groupName : " )
				.append( this.groupName )
				.append( "]\n" )
				.toString();
	}

	public JSONObject toJsonObject()
	{
		JSONObject answer = new JSONObject();
		answer.put( "id" ,id == null ? "" : id );
		answer.put( "groupName" ,groupName == null ? "" : groupName );
		return answer;
	}

	public String toXml()
	{
		StringBuilder answer = new StringBuilder();
		answer.append( "<item>\n" );
		answer.append( "  <id>" ).append( id == null ? "" : id ).append( "</id>\n" );
		answer.append( "  <groupName>" ).append( groupName == null ? "" : groupName ).append( "</groupName>\n" );
		answer.append( "</item>\n" );
		return answer.toString();
	}
}
/* Honey v3.1 Test - version:4 - OriginalChecksum:Bb880ed4956c73ce51d43a2d7164c3a85 (do not edit this line) */
